package com.pug.service.banner;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pug.mapper.banner.BannerMapper;
import com.pug.pojo.Banner;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022/3/16$ 23:42$
 */
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements IBannerService {
    /**
     * 查询轮播图 非线程池做法
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Override
    public List<Banner> findIndexBaner(Integer pageNo, Integer pageSize) {
        Page<Banner> page=new Page(pageNo,pageSize);
        QueryWrapper<Banner> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("status",1);
        queryWrapper.orderByAsc("sorted");
        Page<Banner> page1 = this.page(page, queryWrapper);
        List<Banner> records = page1.getRecords();
        return records;
    }
}
